package com.code.day03.duotai;


import com.code.day03.abstractx.Dog;

public class Main {
    public static void main(String[] args) {
        Fu fu = new Zi();
        fu.eat();

        Cat cat = new Cat();
        method(cat);

    }

    public static void method(Fu fu){   //Fu fu = cat, Fu fu = zi多态方法 参数父类 可以传入任意子类对象就调用重写方法

        if(fu instanceof Cat cat){
            cat.eat();
        }
        else System.out.println("类型不对");

    }
}
